#include <bits/stdc++.h>
using namespace std;
long long v[100005],a[100005],d[100005];
int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    long long T,sum=0;
    cin>>T;
    long long n,m,L,V;
    cin>>n>>m>>L>>V;
    long long P[m+5];
    for(int i=0;i<n;i++)
    {
        cin>>d[i]>>v[i]>>a[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>P[i];
    }
    for(int i=0;i<n;i++)
    {
        if(v[i]>=V) sum++;
    }
    cout<<sum<<" "<<m-1;
    return 0;
}
